<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="utf-8">
    <title>Open Source BMS</title>
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <link rel="stylesheet" href="__ROOT__/admin/js/layui/css/layui.css">
    <link rel="stylesheet" href="__ROOT__/admin/css/admin.css">
    <script src="__ROOT__/admin/js/jquery-3.2.1.min.js"></script>
    <!--[if lt IE 9]>
    <script src="__ROOT__/admin/__JS__/html5shiv.min.js"></script>
    <script src="__ROOT__/admin/__JS__/respond.min.js"></script>

    <style>
        .login .login-form input {color: #000;}
    </style>
    <![endif]-->
</head>
<body class="login">
<div class="login-title">Open Source BMS</div>
<form class="layui-form login-form" action="{:url('revise')}" method="post" >
    <div class="layui-form-item">
        <label class="layui-form-label">用户名</label>
        <div class="layui-input-block">
            <input type="text" name="username" id="useradmin" required lay-verify="required" autocomplete="off" class="layui-input">
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">新密码</label>
        <div class="layui-input-block">
            <input type="password" name="password" id="pwd" required lay-verify="required" class="layui-input">
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">确认密码</label>
        <div class="layui-input-block">
            <input type="password" name="passwords"  id="pwds" required lay-verify="required" class="layui-input">
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">绑定邮箱</label>
        <div class="layui-input-block">
            <input type="text" name="email"  id="email" required lay-verify="required" class="layui-input">
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">验证码</label>
        <div class="layui-input-block">
            <input type="text" name="code" id="code" required lay-verify="required" class="layui-input layui-input-inline">
            <input type="button" id="btn" value="免费获取验证码" class="layui-btn layui-btn-normal" />
        </div>
    </div>
    <div class="layui-form-item">
        <div class="layui-input-block">
            <button class="layui-btn" lay-submit lay-filter="submit">提交</button>
        </div>
    </div>
</form>

<script>
    // 定义全局JS变量
    var GV = {
        current_controller: "admin/{$controller|default=''}/"
    };
    //ajax传输数据
    $('#btn').click(function(){
        $.post("{:url('mailbox')}",{'adminuser':$('#useradmin').val(),'email':$('#email').val()},function(data){
                  alert(data);
                }
            )
    })
    var wait=60;
    function time(o) {
        if (wait == 0) {
            o.removeAttribute("disabled");
            o.value="免费获取验证码";
            wait = 60;
        } else {

            o.setAttribute("disabled", true);
            o.value="重新发送(" + wait + ")";
            wait--;
            setTimeout(function() {
                        time(o)
                    },
                    1000)
        }
    }
    document.getElementById("btn").onclick=function(){time(this);}



</script>
<script src="__ROOT__/admin/js/jquery.min.js"></script>
<script src="__ROOT__/admin/js/layui/lay/dest/layui.all.js"></script>
<script src="__ROOT__/admin/js/admin.js"></script>
</body>
</html>